package com.framework.spring.scan.util;

import org.springframework.core.type.filter.AbstractTypeHierarchyTraversingFilter;
import org.springframework.core.type.filter.TypeFilter;
import org.springframework.util.StringUtils;

public class InterfaceFiler extends AbstractTypeHierarchyTraversingFilter implements TypeFilter {

	/**
	 * 接口名称
	 */
	private String interfaceName;

	/**
	 *
	 * @param interfaceName 		接口名称
	 * @param considerInherited		是否考虑Inherited
	 * @param considerInterfaces	是否考虑interface
	 */
	protected InterfaceFiler(String interfaceName, boolean considerInherited, boolean considerInterfaces) {
		super(considerInherited, considerInterfaces);
		this.interfaceName = interfaceName;
	}

	@Override
	protected Boolean matchInterface(String interfaceName) {
		if (StringUtils.pathEquals(this.interfaceName, interfaceName)) {
			return true;
		}
		return false;
	}

}
